﻿using System;
using System.Net;
using System.Net.Http;
using System.Web.Http;

using Sustainalytics.ESGRatings.BusinessLogic.Computing;
using Sustainalytics.ESGRatings.Computing.Entities;

namespace Sustainalytics.ESGRatings.Computing.Service.Controllers
{
    [RoutePrefix("api/v1/dataprovisioning/esgsets")]
    public class EsgIndicatorTemplatesController : ApiController
    {
        private readonly ComputationEngine _engine;

        public EsgIndicatorTemplatesController(ComputationEngine engine)
        {
            _engine = engine;
        }

        [Route("{setId}/indicatortemplates")]
        public HttpResponseMessage Post(Guid setId, IndicatorTemplate[] data)
        {
            _engine.SetIndicatorTemplates(setId, data);

            return Request.CreateResponse(HttpStatusCode.Created);
        }
    }
}